#!/bin/sh

do_start()
{
	umount /dev/shm >/dev/null 2>/dev/null
	umount /dev/pts >/dev/null 2>/dev/null
	umount /dev >/dev/null 2>/dev/null
	mount /sys >/dev/null 2>/dev/null
	mount udev /dev -t tmpfs
	mkdir -p /dev/pts
	mkdir -p /dev/shm
	mount devpts /dev/pts -t devpts -o gid=5,mode=620
	mount devshm /dev/shm -t tmpfs
	mknod /dev/null c 1 3
	mknod /dev/tty  c 5 0
	mknod /dev/tty0 c 4 0
	mknod /dev/tty1 c 4 1
	/sbin/udevtrigger ##>/dev/null 2>/dev/null
	/sbin/udevd -d ##>/dev/null 2>/dev/null
}

do_stop()
{
	killall /sbin/udevd
	umount /dev/pts
	umount /dev/shm
	umount /dev
}

case $1 in
start)
	do_start $2
	;;
stop)
	do_stop $2
	;;
restart|reload)
	do_stop $2
	do_start $2
	;;
status)
	do_status $2
	;;
*)
	echo "Usage: $0 {start|stop|restart|status}"
	exit 1
	;;
esac

